#ifndef TRACE_H
#define TRACE_H

#include <stdio.h>
#include <stdint.h>

#define TRACE_PARAM_MAX 8

typedef enum {
    TRACE_CYCLOID    = 0,   //摆线
    //...
} Trace_Type;

typedef struct {
    double r;   //半径
    double w;   //角速度
    double x_start;   //位置初始值
    double y_start;   //
    double z_start;   //

} Trace_Cycloid_Param, *pTrace_Cycloid_Param;

/* 轨迹 抽象类 */
class Trace {
public:
    Trace(Trace_Type type, void *param, uint8_t len);
    virtual ~Trace() = 0;
    virtual int32_t trace_init() = 0;
    virtual int32_t trace_deinit() = 0;
    void *get_trace_param() {return param;}
    Trace_Type get_trace_type() {return type;}
    double *get_pos() {return pos;}
    virtual uint32_t trace_generate(double &time) = 0;
    virtual int32_t trace_param_sync(void *param) = 0;

protected:
    double pos[3] = {0.0f};         //轨迹位置 xyz

private:
    Trace_Type type;                //轨迹类型
    double param[TRACE_PARAM_MAX];  //运动参数
};


class Trace_Cycloid : public Trace {
public: 
    Trace_Cycloid(Trace_Type type, void *param, uint8_t len) : Trace(type, param, len) { }
    int32_t trace_init() override;
    int32_t trace_deinit() override;
    uint32_t trace_generate(double &time) override;
    int32_t trace_param_sync(void *param) override;
protected:

private:
    Trace_Cycloid_Param cycld_param;
};

#endif